<template>
<div class="box">
    <h3>子组件</h3>
    <p>玩具：{{ toy }}</p>
    <p>书籍：{{ book }}</p>
    <el-button @click="updateA($parent)">我要买车</el-button>
</div>
</template>

<script lang="ts" setup name="Child">
import { ref } from 'vue';


let toy = ref('挖掘机')
let book = ref(6)

function updateA(parent:any){
    parent.a -= 1
}

defineExpose({toy,book})
</script>

<style scoped>
.box{
    background-color: rgb(151, 153, 58);
    padding: 20px;
    border-radius: 10px;
}
</style>